﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="pgRevisar.aspx.cs" Inherits="EGuayas.Web.EGlobal.pgRevisar" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Register Src="~/Licenciamiento/dma/wucFirma.ascx" TagPrefix="uc2" TagName="wucFirma" %>
<%@ Register Src="~/EGlobal/ucInfoDocumentos.ascx"  TagPrefix="uc1" TagName="ucInfoDocumentos" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link  href="~/Resources/css/Style.css"  rel="stylesheet" />
    <!-- Load Ext JS --> 
    <script src="../Resources/js/Global.js"></script>
   
</head>
<body>  
    <form id="Form1" runat="server"> 
        <ext:ResourceManager ID="pgIdCategManager" runat="server" DirectMethodNamespace="DMRevizar" />     
        <uc1:ucInfoDocumentos runat="server" id="ucInfoDocumentos" />
        <ext:Viewport ID="Viewport1" runat="server" Layout="BorderLayout">
            <Items>  
              <ext:FormPanel ID="FormPanel4" runat="server" Region="Center" Layout="VBoxLayout">
                <LayoutConfig>
                    <ext:VBoxLayoutConfig Align="Stretch" />
                </LayoutConfig> 
                   <Items>       
               <%--:: Venana popup --%>
             
           <ext:Window
            ID="winAprobar"
            runat="server"
            Height="400"
            Width="850"
            ButtonAlign="Center"
            BodyStyle="background-color: #fff;"
            BodyPadding="5"
            Hidden="true"
            CloseAction="Hide"
            Plain="true" 
                               
            HeaderPosition="Bottom"
            Layout="BorderLayout">
            <Items>
                <ext:Panel ID="plDocumentoApro" runat="server"
                    Region="Center"
                    Icon="Zoom"
                    BodyPadding="6"
                    Header="true"
                    ButtonAlign="Left"
                    Layout="AnchorLayout">
                    <Items>
                         <ext:Hidden Text="" ID="hdRuta" Name="Ruta" runat="server"></ext:Hidden>  
                    </Items>
                    <Buttons>
                        <ext:Button runat="server" Text="Descargar" >
                             <DirectEvents>                       
                                <Click OnEvent="btnDowload_Click">
                                    <ExtraParams>
                                        <ext:Parameter Name="Ruta" Value="#{hdRuta}.getValue()" Mode="Raw" />                             
                                    </ExtraParams>                                    
                                    <Confirmation ConfirmRequest="True" Message="Esta seguro de realizar esta acción?" Title="Aviso"></Confirmation>
                                </Click>                        
                            </DirectEvents>
                        </ext:Button>
                    </Buttons>
                </ext:Panel>
                <ext:FormPanel
                    ID="forPanelApro"
                    Region="East"
                    Split="true"
                    runat="server"
                    Width="330"
                    Title="Revizar"
                    BodyPadding="5"
                    Icon="NoteEdit"
                    Collapsible="true"
                    Layout="FitLayout">
                    <FieldDefaults LabelWidth="75" LabelPad="20" LabelSeparator="" />
                    <Items>
                        <ext:Panel ID="Panel3" runat="server" Border="false" Layout="Form" ColumnWidth=".5" LabelAlign="Top">
                            <Defaults>
                             
                                <ext:Parameter Name="MsgTarget" Value="side" />
                            </Defaults>
                            <Items>       
                              
                               <ext:Hidden Text="" ID="hIdArchivo" Name="Id" runat="server"></ext:Hidden>                       
                               <ext:Hidden Text="" ID="hdModulo" Name="TablaInfo" runat="server"></ext:Hidden>
                               <ext:Hidden Text="" ID="hdRevision" Name="IdRevision" runat="server"></ext:Hidden>
                               <ext:Hidden Text="" ID="hdIdInforme" Name="IdInforme" runat="server"></ext:Hidden>
                               <ext:RadioGroup ID="rdgSiNoApro"  AllowBlank="false"
                                    GroupName="rdgSiNo_group"
                                    runat="server"
                                    Anchor="none"
                                    FieldLabel="Corregir">
                                    <LayoutConfig>
                                        <ext:CheckboxGroupLayoutConfig AutoFlex="false" />
                                    </LayoutConfig>
                                    <Defaults>
                                        <ext:Parameter Name="name" Value="ccType" />
                                        <ext:Parameter Name="style" Value="margin-right:15px;" />
                                    </Defaults>
                                    <Items>
                                        <ext:Radio ID="Radio3"
                                            runat="server"
                                            InputValue="S"
                                            BoxLabel="Si" />
                                        <ext:Radio ID="Radio4"
                                            runat="server"
                                            InputValue="N"
                                            BoxLabel="No" />
                                        <ext:Radio ID="Radio6"
                                            runat="server"
                                            Hidden="true"
                                            InputValue="C"
                                            FieldLabel="Corregido" />
                                    </Items>
                                    <Listeners>
                                        <Change  Handler="pgFn.ChangeRadioOpc( newValue, oldValue);"></Change>
                                    </Listeners>
                                </ext:RadioGroup>
                                <ext:ComboBox runat="server" ID="cbxEstadoDMA" Name="EstadoDMA" ValueField="Codigo" 
                                    DisplayField="Nombre" FieldLabel="Resolución" LabelAlign="Left" 
                                   AllowBlank="false">
                                                    <Store>
                                                        <ext:Store runat="server" ID="stoEstadosDMA">
                                                            <Model>
                                                                <ext:Model ID="Model4" runat="server">
                                                                    <Fields>
                                                                        <ext:ModelField  Name="Id"/>
                                                                        <ext:ModelField  Name="Nombre"/>
                                                                        <ext:ModelField  Name="Codigo"/>
                                                                    </Fields>
                                                                </ext:Model>
                                                            </Model>
                                                        </ext:Store>
                                                    </Store>
                                             </ext:ComboBox>
                                <ext:TextArea runat="server" ID="txtCometarioRevizar"   AllowBlank="false" FieldLabel="Comentario" Height="190" AutoScroll="true"></ext:TextArea>
                                <ext:Hidden Text="" ID="hddnDocUpVers" Name="Version" runat="server"></ext:Hidden>
                                <ext:Hidden Text="" ID="hddnDocUpRef" Name="Referencia" runat="server"></ext:Hidden>
                                <ext:FileUploadField
                                ID="FileUploadDocUp"                      
                                runat="server"
                                EmptyText="Seleccione documento"
                                FieldLabel="Documento"
                                ButtonText=""
                                Icon="ImageAdd">
                                                                                             
                              </ext:FileUploadField>
                                </Items>                     
                         </ext:Panel>
                    </Items>
                    <Listeners>
                        <ValidityChange Handler="#{btnAprobar}.setDisabled(!valid);#{btnCorreguir}.setDisabled(!valid);" />
                    </Listeners>
                </ext:FormPanel>

            </Items>
            <Buttons>
                <ext:Button ID="btnAprobar" runat="server" Text="Aprobar" Disabled="true"  Hidden="true"
                    FormBind="true">
                    <DirectEvents>                       
                        <Click OnEvent="btnAprobar_Click" After="AppGlobalJs.closeWin(#{winAprobar})">
                            <ExtraParams>
                                <ext:Parameter Name="IdArchivo" Value="#{hIdArchivo}.getValue()" Mode="Raw" />
                                <ext:Parameter Name="IdRevision" Value="#{hdRevision}.getValue()" Mode="Raw" />
                                <ext:Parameter Name="IdInforme" Value="#{hdIdInforme}.getValue()" Mode="Raw" />
                                <ext:Parameter Name="Modulo" Value="#{hdModulo}.getValue()" Mode="Raw" />
                                <ext:Parameter Name="EstadoDMA" Value="#{cbxEstadoDMA}.getValue()" Mode="Raw" />
                                <ext:Parameter Name="Revizar" Value="#{rdgSiNoApro}.items.get(0).getGroupValue()" Mode="Raw" />
                                <ext:Parameter Name="Comentarios" Value="#{txtCometarioRevizar}.getValue()" Mode="Raw" /> 
                            </ExtraParams>
                            <EventMask ShowMask="true"></EventMask>
                            <Confirmation ConfirmRequest="True" Message="Esta seguro de realizar esta acción?" Title="Aviso"></Confirmation>
                        </Click>                        
                    </DirectEvents>
                </ext:Button>
                <ext:Button ID="btnCorreguir" runat="server" Text="Corregir" Disabled="true" Hidden="true"
                            FormBind="true">
                            <DirectEvents>
                                <Click OnEvent="btnCorreguir_Click" After="AppGlobalJs.closeWin(#{winAprobar})">
                                    <ExtraParams>
                                        <ext:Parameter Name="IdArchivo" Value="#{hIdArchivo}.getValue()" Mode="Raw" />
                                        <ext:Parameter Name="IdRevision" Value="#{hdRevision}.getValue()" Mode="Raw" />
                                        <ext:Parameter Name="IdInforme" Value="#{hdIdInforme}.getValue()" Mode="Raw" />
                                        <ext:Parameter Name="Modulo" Value="#{hdModulo}.getValue()" Mode="Raw" />
                                        <ext:Parameter Name="Revizar" Value="#{rdgSiNoApro}.items.get(0).getGroupValue()" Mode="Raw" />
                                        <ext:Parameter Name="Comentarios" Value="#{txtCometarioRevizar}.getValue()" Mode="Raw" />
                                        <ext:Parameter Name="hddnDocUpVers" Value="#{hddnDocUpVers}.getValue()" Mode="Raw" />
                                        <ext:Parameter Name="hddnDocUpRef" Value="#{hddnDocUpRef}.getValue()" Mode="Raw" />
                                    </ExtraParams>
                                    <EventMask ShowMask="True"></EventMask>
                                </Click>
                            </DirectEvents>
                </ext:Button>
                <ext:Button ID="Button1" runat="server" Text="Cancelar" OnClientClick="AppGlobalJs.closeWin(#{winAprobar})">
                    <Listeners>
                    </Listeners>
                </ext:Button>
            </Buttons>
            <Listeners>
                <BeforeHide Handler="#{forPanelApro}.getForm().reset();#{btnAprobar}.hide();#{btnCorreguir}.hide();"></BeforeHide>
            </Listeners>
        </ext:Window>
           <ext:Window
	            ID="winCorreguir"
	            runat="server"
	            Height="350"
	            Width="850"
	            ButtonAlign="Center"
	            BodyStyle="background-color: #fff;"
	            BodyPadding="5"
	            Hidden="true"
	            CloseAction="Hide"
	            Plain="true"
	            HeaderPosition="Bottom"
	            Layout="BorderLayout">
	            <Items>
                    <ext:Panel ID="Panel4" runat="server" Region="Center" Layout = "AccordionLayout">
                     <Items>
		                        <ext:Panel ID="plDocumento" runat="server"
			                        Region="Center"
			                        Icon="Zoom"
			                        BodyPadding="6"
			                        Header="true"
			                        Layout="AnchorLayout"
			                        Title="Documento">
			                        <Items>
			                        </Items>
		                        </ext:Panel>
                                <ext:Panel ID="Panel1" runat="server"  Title="Historial de revisiones" Layout="BorderLayout" Icon="TableSort">
                                            <Items>
                                               <ext:GridPanel
                                     
                                                    ID ="gpComentarios" 
                                                    Region="Center"                              
                                                    runat="server"                                           
                                                    Height="450">
                                                    <Store>
                                                        <ext:Store ID="Store4" runat="server" PageSize="25"  RemotePaging="false">
                                                            <Model>
                                                                <ext:Model ID="Model5" runat="server" IDProperty="Id">
                                                                    <Fields>                                                    
                                                                        <ext:ModelField Name="FechaCreacion" Type="Date" />                                                    
                                                                        <ext:ModelField Name="Id" Type="String" /> 
                                                                        <ext:ModelField Name="Nombre" Type="String" />                                                   
                                                                        <ext:ModelField Name="Comentarios" Type="String" /> 
                                                                        <ext:ModelField Name="Version"/>                                                  
                                                                    </Fields>
                                                                </ext:Model>                                                          
                                                            </Model> 
                                                                                              
                                                                <Proxy>
                                                                    <ext:PageProxy DirectFn="DMRevizar.BindDataComentariosVersion">
                                                                        <Reader>
                                                                            <ext:JsonReader></ext:JsonReader>
                                                                        </Reader>
                                                                    </ext:PageProxy>
                                                                </Proxy>   
                                                        </ext:Store>
                                                    </Store>
                                                    <ColumnModel ID="ColumnModel4" runat="server">
                                                        <Columns>
                                                            <ext:RowNumbererColumn ID="RowNumbererColumn2" 
                                                                runat="server" 
                                                                Width="40" 
                                                                Sortable="false" />
                                                            <ext:Column ID="Column18"  runat="server" Text="Id" DataIndex="Id" Flex="1" Hidden="true"/>  
                                                            <ext:DateColumn ID="DateColumn3" runat="server" Text="Fecha" Width="95" DataIndex="FechaCreacion" Format="dd-m-yy" /> 
                                                            <ext:Column ID="Column20"  runat="server" Text="Nombre"  DataIndex="Nombre"  />                                                   
                                                            <ext:Column ID="Column19"  runat="server" Text="Comentarios"  DataIndex="Comentarios"  RightCommandAlign="true" Flex="1" />
                                                            <ext:Column ID="Column21"  runat="server" Text="Version"  DataIndex="Version"  Width="35" /> 
                                                        </Columns>                                                    
                                                    </ColumnModel>
                               
                                                        <Features>
                                                        <ext:GridFilters runat="server" ID="GridFilters2" Local="true"  MenuFilterText="Filtrar por">
                                                            <Filters>
                                                                <ext:StringFilter DataIndex="Nombre" EmptyText="Nombre" />
                                                                <ext:DateFilter DataIndex="FechaCreacion" AfterText="Despues de" BeforeText="Antes de"  OnText="En">
                                                                    <DatePickerOptions runat="server" TodayText="Ahora" />
                                                                </ext:DateFilter>                                                           
                                                            </Filters>
                                                        </ext:GridFilters>
                                                    </Features>
                                                    <Plugins>
                                                        <ext:BufferedRenderer ID="BufferedRenderer2" runat="server" />
                                                    </Plugins>   
                                                    <View>
                                                        <ext:GridView ID="GridView4" runat="server" TrackOver="false" />
                                                    </View>
                                        
                             
                                                <Listeners>
                                                   <SelectionChange Handler="selected.length && #{DetailPanel}.update(selected[0].data.Comentarios,false);" />
                                                </Listeners>      
                                                </ext:GridPanel>
                                   
                                              <ext:Panel ID="DetailPanel" 
                                  
                                                runat="server" 
                                                Region="South"
                                                Margins="5 5 5 5"
                                                Title="Detalle comentarios" 
                                                Height="100" 
                                                AutoScroll="true"
                                                Icon="Information"
                                                BodyPadding="7"
                                                BodyStyle="background: #ffffff;"
                                                Html="Selecione una fila de historiar para ver detalle"> 
                             
                                            </ext:Panel>
                                            </Items>
                                        </ext:Panel>
		            </Items>
                    </ext:Panel>
                        <ext:FormPanel
			            ID="forPanelComentarioInf"
			            Region="East"
			            Split="true"
			            runat="server"
			            Width="330"
		
			            BodyPadding="5"
			            Icon="NoteEdit"
			            Collapsible="true"
			            Layout="FitLayout">
			            <FieldDefaults LabelWidth="75" LabelPad="20" LabelSeparator="" />
			            <Items>
				            <ext:Panel ID="Panel2" runat="server" Border="false" Layout="Form" ColumnWidth=".5" LabelAlign="Top">
					            <Defaults>
						         
						            <ext:Parameter Name="MsgTarget" Value="side" />
					            </Defaults>
					            <Items>
						           <ext:Hidden Text="" ID="hdId" Name="Id" runat="server"></ext:Hidden>                       
                                   <ext:Hidden Text="" ID="hdTa" Name="TablaInfo" runat="server"></ext:Hidden>     
                                   <%--
                                    <ext:TabPanel 
                                        ID="TabPanel2" 
                                        runat="server"
                                    
                                        Margins="5 0 5 5">   
                                        <Items>    
                                            <ext:Panel ID="Tab1" runat="server" Title="Nuevo Comentario" BodyPadding="5">
                                              <Items>
                                    --%>   
                                                    <ext:TextArea runat="server" ID="txtCometario"  Height="190" AutoScroll="true"  Width="350" FieldLabel="Nuevo Comentario" LabelAlign="Top"></ext:TextArea>  
						            <%--      
                                              </Items>
                                            </ext:Panel>
                                            <ext:Panel ID="Tab2" runat="server" Title="Comentarios" BodyPadding="5">
                                               <Items>
                                                    <ext:TextArea runat="server" ID="txtCmtOld" Name="Comentarios" Height="190" AutoScroll="true" 
                                                        ReadOnly="true" Width="300" AllowBlank="false"></ext:TextArea>  
						          
                                              </Items>
                                           </ext:Panel>
                                        </Items>                            
                                    </ext:TabPanel>
                                     --%>                     
                               </Items>
				            </ext:Panel>
			            </Items>
			            <Listeners>
				            <ValidityChange Handler="#{btnWinComentarinfOk}.setDisabled(!valid);" />
			            </Listeners>
		            </ext:FormPanel>

	            </Items>
	            <Buttons>
		            <ext:Button ID="btnWinComentarinfOk" runat="server" Text="Aceptar" Disabled="true"
			            FormBind="true">
			            <DirectEvents>
				            <Click OnEvent="btnComentarios_Click" After="AppGlobalJs.closeWin(#{winCorreguir})">
					            <ExtraParams>
						                <ext:Parameter Name="IdArchivo" Value="#{hdId}.getValue()" Mode="Raw" />                                       
                                      
                                        <ext:Parameter Name="Modulo" Value="#{hdTa}.getValue()" Mode="Raw" />
						             <ext:Parameter Name="Comentarios" Value="#{txtCometario}.getValue()" Mode="Raw" />
					            </ExtraParams>
					            <EventMask ShowMask="True"></EventMask>
				            </Click>
			            </DirectEvents>
		            </ext:Button>
		            <ext:Button ID="Button2" runat="server" Text="Cancelar" OnClientClick="AppGlobalJs.closeWin(#{winCorreguir})">
			            <Listeners>
			            </Listeners>
		            </ext:Button>
	            </Buttons>
	            <Listeners>
		            <BeforeHide Handler="#{forPanelComentarioInf}.getForm().reset();"></BeforeHide>
	            </Listeners>
            </ext:Window>
            <ext:TabPanel ID="TabPanel1" runat="server"  Flex="1">
                <Items>
                     <ext:FormPanel ID="FormPanel1" runat="server" Region="Center" Layout="Fit"     Title  ="Documentos a Revizar" 
                                    Icon        ="PageWhiteStack" >
                           
                            <Items>  
                                 <ext:Hidden runat="server" ID="hddDirector" Text=""></ext:Hidden>    
                                 <ext:Hidden runat="server" ID="hddCodigoRol" Text=""></ext:Hidden>                         
                                
                                                <ext:GridPanel
                                                    ID="gpDocumentosLoad"
                                                    runat="server"                                           
                                                    Height="90">
                                                    <Store>
                                                        <ext:Store ID="Store2" runat="server">
                                                            <Model>
                                                                <ext:Model ID="Model2" runat="server" IDProperty="Id">
                                                                    <Fields>
                                                                        <ext:ModelField Name="FaseLicId" Type="String" />
                                                                        <ext:ModelField Name="FechaCreacion" Type="Date" />
                                                                        <ext:ModelField Name="FechaFirmado" Type="Date" />
                                                                        <ext:ModelField Name="Firmado" Type="String" />
                                                                        <ext:ModelField Name="Id" Type="String" />
                                                                        <ext:ModelField Name="Descripcion" Type="String" />
                                                                        <ext:ModelField Name="Nombre" Type="String" />
                                                                        <ext:ModelField Name="PersonaId" Type="String" />
                                                                        <ext:ModelField Name="PersonaNombres" Type="String" />
                                                                        <ext:ModelField Name="Referencia" Type="String" />
                                                                        <ext:ModelField Name="RequiereFirmar" Type="String" />
                                                                        <ext:ModelField Name="Ruta" Type="String" />
                                                                        <ext:ModelField Name="TipoDocumento" Type="String" />
                                                                        <ext:ModelField Name="SubirNuevo" Type="String" />
                                                                        <ext:ModelField Name="Version" Type="Int" />
                                                                        <ext:ModelField Name="RevicionFaseId" Type="String" />
                                                                        <ext:ModelField Name="AprobadoRevision" Type="String" />
                                                                        <ext:ModelField Name="TablaInfo" Type="String" />
                                                                        <ext:ModelField Name="IdRevision" Type="String" /> 
                                                                        <ext:ModelField Name="IdInforme" Type="String" />
                                                                        <ext:ModelField Name="CodigoFase" Type="String"/>
                                                                        <ext:ModelField Name="TablaId" Type="String" />
                                                                        <ext:ModelField Name="NombreExpediente" Type="String"/>
                                                                        <ext:ModelField Name="Fase" Type="String"/>
                                                                    </Fields>
                                                                </ext:Model>
                                                            </Model>                                      
                                                            <Proxy>
                                                                <ext:PageProxy DirectFn="DMRevizar.BindDataRevizar">
                                                                    <Reader>
                                                                        <ext:JsonReader></ext:JsonReader>
                                                                    </Reader>
                                                                </ext:PageProxy>
                                                            </Proxy>
                                                        </ext:Store>
                                                    </Store>
                                                    <ColumnModel ID="ColumnModel2" runat="server">
                                                        <Columns>
                                                            <ext:Column  runat="server" Text="Id" DataIndex="Id" Flex="1" Hidden="true"/>
                                                            <ext:Column  runat="server" Text="Nombre" DataIndex="Nombre" Flex="1"/>
                                                            <ext:Column   runat="server" Text="Expediente" DataIndex="NombreExpediente" />
                                                            <ext:Column   runat="server" Text="Fase" DataIndex="Fase" />
                                                            <ext:Column  runat="server" Text="Decripción" DataIndex="Descripcion" /> 
                                                            <ext:DateColumn runat="server" Text="Fecha" Width="95" DataIndex="FechaCreacion" Format="dd-m-yy" />
                                                            <ext:Column ID="Column12" runat="server">
                                                                <Commands>
                                                                    <ext:ImageCommand CommandName="RevApro" Icon="PageWhiteRefresh" Text="Documentos">
                                                                
                                                                    </ext:ImageCommand>
                                                                </Commands>
                                                               
                                                                <Listeners>
                                                                    <Command Handler="pgFn.ShwoAllDoc(record);"></Command>
                                                                </Listeners>
                                                            </ext:Column>   
                                                           
                                                            <ext:Column ID="Column1" runat="server">
                                                                <Commands>
                                                                    <ext:ImageCommand CommandName="RevApro" Icon="FolderGo" Text="Revizar">
                                                                
                                                                    </ext:ImageCommand>
                                                                </Commands>
                                                                <PrepareCommand Fn="pgFn.PrepareCommand" />
                                                                <Listeners>
                                                                    <Command Handler="pgFn.RevApro(record);"></Command>
                                                                </Listeners>
                                                                <DirectEvents>
                                                                    <Command OnEvent="RevApro_Command">
                                                                        <ExtraParams>
                                                                            <ext:Parameter Name="CodigoFase" Value="record.data.CodigoFase" Mode="Raw"/>
                                                                            <ext:Parameter Name="TablaId" Value="record.data.TablaId" Mode="Raw"/>
                                                                            <ext:Parameter Name="TablaInfo" Value="record.data.TablaInfo" Mode="Raw"/>
                                                                        </ExtraParams>
                                                                        <EventMask ShowMask="True"></EventMask>
                                                                    </Command>
                                                                </DirectEvents>
                                                            </ext:Column>                                                                               
                                                        </Columns>                                                    
                                                    </ColumnModel>
                                                    <Plugins>
                                                        <ext:RowExpander ID="RowExpander1" runat="server">
                                                            <Loader ID="Loader1" runat="server" DirectMethod="#{DirectMethods}.GetSubDoc" Mode="Component">
                                                                <LoadMask ShowMask="true" />
                                                                <Params>
                                                                    <ext:Parameter Name="id" Value="this.record.data.Referencia" Mode="Raw" />
                                                                    <ext:Parameter Name="tabla" Value="this.record.data.TablaInfo" Mode="Raw" />
                                                                </Params>
                                                            </Loader>
                                                        </ext:RowExpander>
                                                    </Plugins>                                                              
                                                </ext:GridPanel>
                                                  
                          
                            </Items>
                       
                           <BottomBar>
                             <ext:StatusBar 
                                    ID="StatusBar2" 
                                    runat="server"
                                    StatusAlign="Left">
                                    <Items>                                
                                        <ext:ToolbarTextItem ID="ToolbarTextItem1" runat="server" Text="" Cls="ux-bold-text-item"  Margin="15"/>
                                    </Items>
                                </ext:StatusBar>
                            </BottomBar>
               </ext:FormPanel>
                     <ext:FormPanel ID="FormPanel2" runat="server" Region="Center" Layout="Fit"  Title  ="Documentos Revizados" 
                                Icon        ="BookOpenMark" >                       
                        <Items>                                    
                             
                                            <ext:GridPanel
                                                ID="gpDocRevizados"
                                                runat="server"                                           
                                                Height="90">
                                                <Store>
                                                    <ext:Store ID="Store1" runat="server">
                                                        <Model>
                                                            <ext:Model ID="Model1" runat="server" IDProperty="Id">
                                                                <Fields>
                                                                    <ext:ModelField Name="FaseLicId" Type="String" />
                                                                    <ext:ModelField Name="FechaCreacion" Type="Date" />
                                                                    <ext:ModelField Name="FechaFirmado" Type="Date" />
                                                                    <ext:ModelField Name="Firmado" Type="String" />
                                                                    <ext:ModelField Name="Id" Type="String" />
                                                                    <ext:ModelField Name="Descripcion" Type="String" />
                                                                    <ext:ModelField Name="Comentarios" Type="String" />
                                                                    <ext:ModelField Name="Nombre" Type="String" />
                                                                    <ext:ModelField Name="PersonaId" Type="String" />
                                                                    <ext:ModelField Name="PersonaNombres" Type="String" />
                                                                    <ext:ModelField Name="Referencia" Type="String" />
                                                                    <ext:ModelField Name="RequiereFirmar" Type="String" />
                                                                    <ext:ModelField Name="Ruta" Type="String" />
                                                                    <ext:ModelField Name="TipoDocumento" Type="String" />
                                                                    <ext:ModelField Name="SubirNuevo" Type="String" />
                                                                    <ext:ModelField Name="Version" Type="Int" />
                                                                    <ext:ModelField Name="EstadoInforme" Type="String" />
                                                                    <ext:ModelField Name="AprobadoRevision" Type="String" /> 
                                                                    <ext:ModelField Name="TablaInfo" Type="String" />
                                                                        <ext:ModelField Name="NombreExpediente" Type="String"/>
                                                                        <ext:ModelField Name="Fase" Type="String"/>
                                                                </Fields>
                                                            </ext:Model>
                                                        </Model>                                      
                                                        <Proxy>
                                                            <ext:PageProxy DirectFn="DMRevizar.BindDataRevizados">
                                                                <Reader>
                                                                    <ext:JsonReader></ext:JsonReader>
                                                                </Reader>
                                                            </ext:PageProxy>
                                                        </Proxy>
                                                    </ext:Store>
                                                </Store>
                                                <ColumnModel ID="ColumnModel1" runat="server">
                                                    <Columns>
                                                        <ext:Column ID="Column2"  runat="server" Text="Id" DataIndex="Id" Flex="1" Hidden="true"/>
                                                        <ext:Column ID="Column3"  runat="server" Text="Nombre" DataIndex="Nombre" Flex="1"/>
                                                        <ext:Column ID="Column13"   runat="server" Text="Expediente" DataIndex="NombreExpediente" />
                                                            <ext:Column ID="Column14"   runat="server" Text="Fase" DataIndex="Fase" />
                                                        <ext:Column ID="Column4"  runat="server" Text="Decripción" DataIndex="Descripcion" /> 
                                                        <ext:Column ID="Column7"  runat="server" Text="Comentario" DataIndex="Comentarios" /> 
                                                        <ext:Column ID="Column9"  runat="server" Text="Estado" DataIndex="EstadoInforme" >
                                                                <Renderer Fn="pgFn.ChangeLabel" />
                                                        </ext:Column>
                                                        <ext:DateColumn ID="DateColumn1" runat="server" Text="Fecha" Width="95" DataIndex="FechaCreacion" Format="dd-m-yy" />
                                                        <ext:Column ID="Column6"  runat="server">
                                                        <Commands>
                                                            <ext:ImageCommand CommandName="View" Icon="Zoom" Text="Vizualizar">
                                                                <ToolTip Text="Vizualizar" />
                                                            </ext:ImageCommand>
                                                        </Commands>
                                       
                                                        <Listeners>
                                                                <Command Handler="AppGlobalJs.showPdf('../../..',record.data.Ruta);" />
                                                        </Listeners>
                                                    </ext:Column>                                                                        
                                                    </Columns>                                                    
                                                </ColumnModel>
                                                <Plugins>
                                                    <ext:RowExpander ID="RowExpander2" runat="server">
                                                        <Loader ID="Loader2" runat="server" DirectMethod="#{DirectMethods}.GetSubDoc" Mode="Component">
                                                            <LoadMask ShowMask="true" />
                                                            <Params>
                                                                <ext:Parameter Name="id" Value="this.record.data.Referencia" Mode="Raw" />
                                                               <ext:Parameter Name="tabla" Value="this.record.data.TablaInfo" Mode="Raw" />
                                                            </Params>
                                                        </Loader>
                                                    </ext:RowExpander>
                                                </Plugins>                                                              
                                            </ext:GridPanel>
                                          
                          
                        </Items>
                       
                       <BottomBar>
                         <ext:StatusBar 
                                ID="StatusBar1" 
                                runat="server"
                                StatusAlign="Left">
                                <Items>                                
                                    <ext:ToolbarTextItem ID="ToolbarTextItem2" runat="server" Text="" Cls="ux-bold-text-item"  Margin="15"/>
                                </Items>
                            </ext:StatusBar>
                        </BottomBar>
           </ext:FormPanel>
                     <ext:FormPanel ID   ="FormPanel3" runat="server" Region="Center" Layout="Fit"     Title  ="Documentos" 
                                    Icon ="NoteAdd" >
                            <Items>  
                                 <ext:Hidden runat="server" ID="Hidden1" Text=""></ext:Hidden>    
                                 <ext:Hidden runat="server" ID="Hidden2" Text=""></ext:Hidden>                         
                                
                                                <ext:GridPanel
                                                    ID="gpDocComentarios"
                                                    runat="server"                                           
                                                    Height="90">
                                                    <Store>
                                                        <ext:Store ID="Store3" runat="server">
                                                            <Model>
                                                                <ext:Model ID="Model3" runat="server" IDProperty="Id">
                                                                    <Fields>
                                                                        <ext:ModelField Name="FaseLicId" Type="String" />
                                                                        <ext:ModelField Name="FechaCreacion" Type="Date" />
                                                                        <ext:ModelField Name="FechaFirmado" Type="Date" />
                                                                        <ext:ModelField Name="Firmado" Type="String" />
                                                                        <ext:ModelField Name="Id" Type="String" />
                                                                        <ext:ModelField Name="Descripcion" Type="String" />
                                                                        <ext:ModelField Name="Nombre" Type="String" />
                                                                        <ext:ModelField Name="PersonaId" Type="String" />
                                                                        <ext:ModelField Name="PersonaNombres" Type="String" />
                                                                        <ext:ModelField Name="Referencia" Type="String" />
                                                                        <ext:ModelField Name="RequiereFirmar" Type="String" />
                                                                        <ext:ModelField Name="Ruta" Type="String" />
                                                                        <ext:ModelField Name="TipoDocumento" Type="String" />
                                                                        <ext:ModelField Name="SubirNuevo" Type="String" />
                                                                        <ext:ModelField Name="Version" Type="Int" />
                                                                        <ext:ModelField Name="RevicionFaseId" Type="String" />
                                                                        <ext:ModelField Name="AprobadoRevision" Type="String" /> 
                                                                        <ext:ModelField Name="Comentarios" Type="String" />
                                                                        <ext:ModelField Name="TablaInfo" Type="String" />
                                                                        <ext:ModelField Name="IdRevision" Type="String" /> 
                                                                        <ext:ModelField Name="IdInforme" Type="String" />
                                                                        <ext:ModelField Name="NombreExpediente" Type="String"/>
                                                                        <ext:ModelField Name="Fase" Type="String"/>
                                                                    </Fields>
                                                                </ext:Model>
                                                            </Model>                                      
                                                            <Proxy>
                                                                <ext:PageProxy DirectFn="DMRevizar.BindDataComentario">
                                                                    <Reader>
                                                                        <ext:JsonReader></ext:JsonReader>
                                                                    </Reader>
                                                                </ext:PageProxy>
                                                            </Proxy>
                                                        </ext:Store>
                                                    </Store>
                                                    <ColumnModel ID="ColumnModel3" runat="server">
                                                        <Columns>
                                                            <ext:Column ID="Column5"  runat="server" Text="Id" DataIndex="Id" Flex="1" Hidden="true"/>
                                                            <ext:Column ID="Column8"  runat="server" Text="Nombre" DataIndex="Nombre" Flex="1"/>
                                                            <ext:Column ID="Column15"   runat="server" Text="Expediente" DataIndex="NombreExpediente" />
                                                            <ext:Column ID="Column16"   runat="server" Text="Fase" DataIndex="Fase" />
                                                            <ext:Column ID="Column10"  runat="server" Text="Decripción" DataIndex="Descripcion" /> 
                                                            <ext:DateColumn ID="DateColumn2" runat="server" Text="Fecha" Width="95" DataIndex="FechaCreacion" Format="dd-m-yy" />
                                                     
                                                           
                                                            <ext:Column ID="Column11" runat="server">
                                                                <Commands>
                                                                    <ext:ImageCommand CommandName="RevComent" Icon="NoteEdit" Text="Comentario">
                                                                
                                                                    </ext:ImageCommand>
                                                                </Commands>
                                                                <PrepareCommand Fn="pgFn.PrepareCommand" />
                                                                <Listeners>
                                                                    <Command Handler="pgFn.RevComent(record);"></Command>
                                                                </Listeners>
                                                            </ext:Column>                                                                               
                                                        </Columns>                                                    
                                                    </ColumnModel>
                                                    <Plugins>
                                                        <ext:RowExpander ID="RowExpander3" runat="server">
                                                            <Loader ID="Loader3" runat="server" DirectMethod="#{DirectMethods}.GetSubDoc" Mode="Component">
                                                                <LoadMask ShowMask="true" />
                                                                <Params>
                                                                    <ext:Parameter Name="id" Value="this.record.data.Referencia" Mode="Raw" />
                                                                    <ext:Parameter Name="tabla" Value="this.record.data.TablaInfo" Mode="Raw" />
                                                                </Params>
                                                            </Loader>
                                                        </ext:RowExpander>
                                                    </Plugins>                                                              
                                                </ext:GridPanel>
                                                  
                          
                            </Items>
                       
                           <BottomBar>
                             <ext:StatusBar 
                                    ID="StatusBar3" 
                                    runat="server"
                                    StatusAlign="Left">
                                    <Items>                                
                                        <ext:ToolbarTextItem ID="ToolbarTextItem3" runat="server" Text="" Cls="ux-bold-text-item"  Margin="15"/>
                                    </Items>
                                </ext:StatusBar>
                            </BottomBar>
               </ext:FormPanel>
              </Items>
            </ext:TabPanel>
            </Items> 
         </ext:FormPanel>
        </Items>
       </ext:Viewport>
        <%--  Wun Firma --%>       
        <uc2:wucFirma runat="server" ID="wucFirma" />
        <%--  Wun Firma --%>
    
    </form>
    <ext:XScript ID="XScript1" runat="server">
        <script type="text/javascript">
            var pgFn = new Object();
            pgFn.myPanel = null;
            pgFn.ShwoAllDoc= function (record) {
                try 
                { 
                    DMRevizar.ShowAllFiles(record.data.TablaId,record.data.TablaInfo,{
                        success: function (result) {
                           
                        },
                        eventMask: {
                            showMask: true,
                            minDelay: 500
                        }
                    });
                }
                catch (jsbug){
                    AppGlobalJs.showBug("pgFn.ShwoAllDoc: " + jsbug);
                }
            };
            pgFn.ChangeLabel= function (value) {
                try 
                { 
                    var template  = '<span style="color:{0};">{1}</span>';
                    var valReturn = '';
                    var valColor  =0;
                    switch(value)
                    {
                        /*case 'PORREVIZAR':valReturn = ''; break;*/
                        case "REVSUBDIR":valReturn = 'Enviado a Revisión'; valColor  =1; break;
                        case "REVDIR":valReturn = 'Revizado'; break;
                        case "APROBADO": valReturn = 'Aprobado'; valColor  =1;break;
                        case "NOTIFICADO": valReturn = 'Notificado';break;
                    }
                    return Ext.String.format(template, (valColor > 0) ? "green" : "red", valReturn);
                }
                catch (jsbug){
                    AppGlobalJs.showBug("pgFn.ChangeLabel: " + jsbug);
                }
            };
            pgFn.PrepareCommand= function (grid, command, record, row) {
                try {
                
                    var estadoRevFase    = record.get('AprobadoRevision');
                    switch (command.command)
                    {                     
                       
                        case  "RevApro":                          
                                command.hidden = false;
                                command.hideMode = 'visibility';
                                if (estadoRevFase==''||estadoRevFase=='S')
                                {
                                    command.disabled=true;
                                }                               
                                break;
                    
                    } 
                }
                catch (jsbug){
                    AppGlobalJs.showBug(" pgFn.PrepareCommand: " + jsbug);
                }
            };
            pgFn.RevComent= function (record) {
                try
                {   
                    var myPanel = null;
                    var myPanelContent = #{plDocumento};
                   
                    #{forPanelComentarioInf}.getForm().loadRecord(record); 
                    //#{gpComentarios}.removeAll();
                 
                    #{gpComentarios}.getStore().load({
                        params: {
                            idArchivo: record.get('Referencia')
                        }
                    });
                   
                    //#{rdgSiNo}.setValue({rdgSiNo_group: record.get('SubirNuevo')});
                    if (myPanelContent != null) {
                        myPanelContent.remove('pnlviewddoc_2', false);
                        myPanel = myPanelContent.add(new Ext.Panel({
                            id: 'pnlviewddoc_2',
                            border: false,
                            anchor: '100% 100%',
                   
                            loader:
                             {
                                 loadMask:
                                     {
                                         showMask: false
                                     },
                                 renderer: "frame",
                                 url:"../pgDetailPdf.aspx?idx= "+ record.data.Ruta
                             },
                            bodyPadding: 6,
                            closable: false,

                        }));
                    }

                    AppGlobalJs.showWin(#{winCorreguir});

                
                } catch (jsbug) {
                    AppGlobalJs.showBug("pgFn.RevComent: " + jsbug)
                }
            };   
            pgFn.RevApro= function (record) {
                try
                { 
                    var myPanel = null;
                    var myPanelContent = #{plDocumentoApro};
                    if (myPanelContent != null) {
                        myPanelContent.remove('pnlviewddoc_1', false);
                        myPanel = myPanelContent.add(new Ext.Panel({
                            id: 'pnlviewddoc_1',
                            border: false,
                            anchor: '100% 100%',
                   
                            loader:
                             {
                                 loadMask:
                                     {
                                         showMask: false
                                     },
                                 renderer: "frame",
                                 url:"../pgDetailPdf.aspx?idx= "+ record.data.Ruta
                             },
                            bodyPadding: 6,
                            closable: false,

                        }));
                    }
                    #{hdRuta}.setValue(record.get('Ruta'));
                    #{forPanelApro}.getForm().loadRecord(record); 
                    #{rdgSiNoApro}.setValue({rdgSiNo_group: record.get('AprobadoRevision')});
                    AppGlobalJs.showWin(#{winAprobar});
                } catch (jsbug) {
                    AppGlobalJs.showBug(" pgFn.RevApro: " + jsbug)
                }
            };  
           
            //Habilitar o deshabilitar comentarios, o botones segun opcion
            pgFn.ChangeRadioOpc  = function (newValue, oldValue) {
                try
                {   
                    #{txtCometarioRevizar}.setValue("");
                    switch(newValue.rdgSiNo_group)
                    {
                        case "S":                        
                            #{txtCometarioRevizar}.allowBlank =false;
                            #{btnAprobar}.hide();
                            #{btnCorreguir}.show();                            
                            break;
                        case "N": 
                            #{txtCometarioRevizar}.allowBlank =true;
                            #{btnAprobar}.show();
                            #{btnCorreguir}.hide();    
                            break;
                    }

                } catch (jsbug) {
                    AppGlobalJs.showBug("pgFn.ChangeRadioOpc: " + jsbug)
                }
            };   
            //Previsualizacion de ventana
           
            
          </script>
    </ext:XScript>     
</body>


</html>
